﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace DeepTalkDBSerice
{
    /// <summary>
    ///  Dummy class to log various errors (YIKES!).
    ///  TODO: Get this doing something real, mate!
    /// </summary>
    class Logger
    {
        public void LogMessage(string msg)
        {
            try
            {
                lock (this)
                {
                    FileInfo f = new FileInfo("c:\\temp\\dtdbservice_log.txt");
                    StreamWriter w;
                    if (!f.Exists)
                    {
                        w = f.CreateText();
                    }
                    else
                    {
                        w = f.AppendText();
                    }
                    w.WriteLine(msg);
                    w.Close();
                    w.Dispose();
                }
                Trace.WriteLine(msg);
            }
            catch
            {
            }
        }

        internal void LogMessage(string p, Exception e)
        {
            LogMessage(p + " - " + e.ToString());
        }
    }
}
